Practically this doesn't make any difference, but once it's possible for
namespaces to not have talk pages, this function would have returned an
invalid Title.
Bug: T165149
Change-Id: I940433c22193d406d8b4a6cab0e6ad37e88e62c6
* get the talk page, if it is a subject page get the talk page
*
* @since 1.25
- * @throws MWException
+ * @throws MWException If the page doesn't have an other page
* @return Title
*/
public function getOtherPage() {
if ( $this->isTalkPage() ) {
return $this->getSubjectPage();
} else {
+ if ( !$this->canHaveTalkPage() ) {
+ throw new MWException( "{$this->getPrefixedText()} does not have an other page" );
+ }
return $this->getTalkPage();
}
}
[ 'Help:Main Page', 'Help talk:Main Page' ],
[ 'Help talk:Main Page', 'Help:Main Page' ],
[ 'Special:FooBar', null ],
+ [ 'Media:File.jpg', null ],
];
}